<script type='text/javascript' src="<?php echo $this->basePath('public/css/dbblack/js/artdialog/artDialog.js?skin=simple'); ?>"></script>
<script type='text/javascript' src="<?php echo $this->basePath('public/css/dbblack/js/artdialog/plugins/iframeTools.js'); ?>"></script>
<link type="text/css" rel="stylesheet" href="<?php echo $this->basePath('public/css/dbblack/css/ucenter.css'); ?>" />

<div class="container clearfix">
    <?php echo $this->partial('shopfront/home/left_menu.phtml'); ?>
    <div class="uc-content">
        <h1 class="title"><span><?php echo $this->translate('退货详情'); ?>：</span></h1>
        <div class="box list-item order-status">
            <?php
            $type_array  = array(1=>$this->translate('退款到账户余额'), 2=>$this->translate('退款到银行'), 3=>$this->translate('退款到第三方支付'));
            $state_array = array(0=>$this->translate('等待处理'), 1=>$this->translate('退款成功'), 2=>$this->translate('退款拒绝'));
            ?>
            <div class="title"><b><?php echo $this->translate('订单号'); ?>：</b><?php echo $this->refund_info->order_sn; ?><b><?php echo $this->translate('状态'); ?>：</b>
                <?php echo $state_array[$this->refund_info->refund_state]; ?>
            </div>

            <p style=" margin-top:10px; margin-bottom:18px;"><button class="btn btn-primary" onclick="location.href='<?php echo $this->url('frontrefund/default'); ?>'" type="button"><?php echo $this->translate('返回列表'); ?></button></p>
        </div>
        <div>
            <table class="simple form">
                <tr>
                    <th class="tl" style="padding-left: 20px;" colspan=4><?php echo $this->translate('申请详情'); ?>：</th>
                </tr>
                <tr>
                    <td class="label"><?php echo $this->translate('订单编号：'); ?></td><td><?php echo $this->refund_info->order_sn; ?></td>
                    <td class="label"><?php echo $this->translate('申请时间：'); ?></td><td><?php echo date("Y".$this->translate('年')."m".$this->translate('月')."d".$this->translate('日')." H".$this->translate('时')."i".$this->translate('分')."s".$this->translate('秒'), $this->refund_info->refund_time); ?></td>
                </tr>
                <tr>
                    <td class="label"><?php echo $this->translate('退款方式：'); ?></td><td <?php if($this->refund_info->refund_type == 1) echo 'colspan="3"'; ?>><?php echo $type_array[$this->refund_info->refund_type]; ?></td>
                    <?php if($this->refund_info->refund_type != 1) { ?>
                        <td class="label">
                            <?php echo $this->translate('退款信息：'); ?>
                        </td>
                    <td>
                        <?php if($this->refund_info->refund_type == 2) { ?>
                            <?php echo '<b>'.$this->translate('开户银行：').'</b>'.$this->escapeHtml($this->refund_info->bank_name); ?><br>
                            <?php echo '<b>'.$this->translate('开户姓名：').'</b>'.$this->escapeHtml($this->refund_info->bank_account); ?><br>
                            <?php echo '<b>'.$this->translate('收款卡号：').'</b>'.$this->escapeHtml($this->refund_info->bank_card_number); ?>
                        <?php } ?>
                        <?php if($this->refund_info->refund_type == 3) { ?>
                            <?php echo '<b>'.$this->translate('支付名称：').'</b>'.$this->escapeHtml($this->refund_info->bank_name); ?><br>
                            <?php echo '<b>'.$this->translate('真实姓名：').'</b>'.$this->escapeHtml($this->refund_info->bank_account); ?><br>
                            <?php echo '<b>'.$this->translate('收款账号：').'</b>'.$this->escapeHtml($this->refund_info->bank_card_number); ?>
                        <?php } ?>
                    </td>
                    <?php } ?>
                </tr>
                <tr>
                    <td class="label"><?php echo $this->translate('退货原因：'); ?></td>
                    <td colspan="3"><?php echo $this->escapeHtml($this->refund_info->refund_info); ?></td>
                </tr>
                <tr>
                    <td class="label"><?php echo $this->translate('退货商品：'); ?></td>
                    <td colspan="3">
                        <?php
                        $refundGoods = explode(',', $this->refund_info->goods_id_str);
                        foreach($this->order_goods as $g_value) {
                            if(!in_array($g_value['order_goods_id'], $refundGoods)) continue;
                            ?>
                            <label><?php echo $this->escapeHtml($g_value['goods_name']); ?></label>
                        <?php } ?>
                    </td>
                </tr>
            </table>
        </div>

        <div>
            <table class="simple form">
                <tr>
                    <th class="tl" style="padding-left: 20px;" colspan=4><?php echo $this->translate('处理详情'); ?>：</th>
                </tr>
                <?php if(empty($this->refund_info->finish_refund_time)) { ?>
                <tr>
                    <td colspan="4"><?php echo $this->translate('等待处理，暂无信息'); ?></td>
                </tr>
                <?php } else { ?>
                <tr>
                    <td class="label"><?php echo $this->translate('处理结果：'); ?></td><td><?php echo $state_array[$this->refund_info->refund_state]; ?></td>
                    <td class="label"><?php echo $this->translate('处理时间：'); ?></td><td><?php echo date("Y".$this->translate('年')."m".$this->translate('月')."d".$this->translate('日')." H".$this->translate('时')."i".$this->translate('分')."s".$this->translate('秒'), $this->refund_info->finish_refund_time); ?></td>
                </tr>
                <?php if($this->refund_info->refund_state == 1) { ?>
                        <tr>
                            <td class="label"><?php echo $this->translate('退货金额：'); ?></td>
                            <td colspan="3"><?php echo $this->refund_info->refund_price; ?></td>
                        </tr>
                <?php } else { ?>
                        <tr>
                            <td class="label"><?php echo $this->translate('处理意见：'); ?></td>
                            <td colspan="3"><?php echo $this->escapeHtml($this->refund_info->re_refund_info); ?></td>
                        </tr>
                <?php } } ?>
            </table>
        </div>

        <div>
            <h2 class="mt20"><?php echo $this->translate('商品清单'); ?></h2>
            <table class="simple mt10">
                <tr>
                    <th colspan="2"><?php echo $this->translate('商品名称'); ?></th>
                    <th width="140"><?php echo $this->translate('商品货号'); ?></th>
                    <th width="100"><?php echo $this->translate('规格'); ?></th>
                    <th width="80"><?php echo $this->translate('商品价格'); ?></th>
                    <th width="40"><?php echo $this->translate('数量'); ?></th>
                    <th width="80"><?php echo $this->translate('小计'); ?></th>
                </tr>

                <?php foreach ($this->order_goods as $goods_key => $goods_value) { ?>

                <tr class="<?php echo $goods_key%2==1 ? 'even' : 'odd'; ?>">
                    <td width="40"><a href="<?php echo $this->url('frontgoods/default', array('goods_id'=>$goods_value['goods_id'], 'class_id'=>$goods_value['class_id'])); ?>" target="_blank"><img src="<?php echo $this->basePath($this->frontwebsite()->shopGoodsImage($goods_value['goods_image'])); ?>" width="40"></a></td>
                    <td>
                        <a href="<?php echo $this->url('frontgoods/default', array('goods_id'=>$goods_value['goods_id'], 'class_id'=>$goods_value['class_id'])); ?>" target="_blank"><?php echo $this->escapeHtml($goods_value['goods_name']); ?></a>
                        <?php if(in_array($goods_value['order_goods_id'], $refundGoods)) echo '<br>[<strong style="color: red">'.$this->translate('已申请退货').'</strong>]'; ?>
                    </td>
                    <td><?php echo $this->escapeHtml($goods_value['goods_item']);?></td>
                    <td>
                        <?php
                        if($goods_value['goods_extend_info']) {
                            echo $goods_value['goods_extend_info'];
                        } else {
                            echo $this->translate('无');
                        }
                        ?>
                    </td>
                    <td><?php echo $this->order_info->currency_symbol . $goods_value['goods_shop_price'] . $this->order_info->currency_unit; ?></td>
                    <td><?php echo $goods_value['buy_num']; ?></td>
                    <td><?php echo $this->order_info->currency_symbol . $goods_value['goods_amount'] . $this->order_info->currency_unit; ?></td>
                </tr>
                <?php } ?>
            </table>
        </div>

        <div class="box p10 tr order-total">
            <div class="pb10">
                <?php if($this->order_info->goods_weight_amount > 0) { ?>
                <p><?php echo $this->translate('商品总重量'); ?>：<?php echo $this->order_info->goods_weight_amount.$this->translate('千克'); ?></p>
                <?php } ?>
                <p><?php echo $this->translate('商品总金额'); ?>：<?php echo $this->order_info->currency_symbol . $this->order_info->goods_amount; ?></p>
                <p>+ <?php echo $this->translate('运费'); ?>：<?php echo $this->order_info->currency_symbol . $this->order_info->express_fee; ?></p>
                <p>+ <?php echo $this->translate('支付手续费'); ?>：<?php echo $this->order_info->currency_symbol . $this->order_info->pay_fee; ?></p>
                <p>- <?php echo $this->translate('购买优惠'); ?>：<?php echo $this->order_info->currency_symbol . $this->order_info->buy_pre_fee; ?></p>
                <p>- <?php echo $this->translate('会员优惠'); ?>：<?php echo $this->order_info->currency_symbol . $this->order_info->buy_pre_fee; ?></p>
                <?php if($this->order_info->coupon_pre_fee > 0) { ?>
                    <p>- <?php echo $this->translate('优惠券优惠'); ?>：<?php echo $this->order_info->currency_symbol . $this->order_info->coupon_pre_fee; ?></p>
                <?php } ?>
                <?php if(isset($this->order_info->integral_buy_price) and $this->order_info->integral_buy_price > 0) { ?>
                    <p>- <?php echo $this->translate('积分购买'); ?>：<?php echo $this->order_info->currency_symbol . $this->order_info->integral_buy_price; ?></p>
                <?php } ?>
                <?php
                if(isset($this->order_amount_log) and !empty($this->order_amount_log)) {
                    foreach($this->order_amount_log as $amount_log) {
                        ?>
                        <p><?php echo $amount_log['order_edit_amount_type']; ?> <?php echo $amount_log['order_edit_amount_info']; ?>：<?php echo $this->order_info->currency_symbol.ltrim($amount_log['order_edit_number'], '-'); ?></p>
                    <?php } } ?>
            </div>
            <div class="t-line pt10 total">
                <?php echo $this->translate('订单总金额'); ?>：<b><?php echo $this->order_info->currency_symbol . $this->order_info->order_amount . $this->order_info->currency_unit; ?></b>
                <?php if ($this->order_info->integral_num > 0) { ?>
                    <br><hr>
                    <?php echo $this->translate('消费积分'); ?>(<?php if ($this->order_info->integral_rule_info != '') {echo $this->order_info->integral_rule_info . ',&nbsp;';} echo $this->translate('交易完成确认收货后才得到积分'); ?>)：<b><?php echo $this->order_info->integral_num; ?><?php echo $this->translate('积分'); ?></b>
                <?php } ?>
                <?php if ($this->order_info->integral_type_2_num > 0) { ?>
                    <br>
                    <?php echo $this->translate('等级积分'); ?>(<?php if ($this->order_info->integral_type_2_num_rule_info != '') {echo $this->order_info->integral_type_2_num_rule_info . ',&nbsp;';} echo $this->translate('交易完成确认收货后才得到积分'); ?>)：<b><?php echo $this->order_info->integral_type_2_num; ?><?php echo $this->translate('积分'); ?></b>
                <?php } ?>
            </div>
        </div>

    </div>
</div>
